//
//  LCWebViewProgressLine.m
//  LCPackage
//
//  Created by 马军凯 on 2021/6/23.
//  Copyright © 2021 龙采科技集团. All rights reserved.
//

#import "LCWebViewProgressLine.h"

@implementation LCWebViewProgressLine

//初始化
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.hidden = YES;
        self.backgroundColor = [RBThemeConfig themeColor];
    }
    return self;
}

//开始加载
- (void)startLoadingAnimation {
    self.hidden = NO;
    self.width = 0.0;
    __weak UIView *weakSelf = self;
    [UIView animateWithDuration:0.4 animations:^{
        weakSelf.width = SCREEN_WIDTH * 0.6;
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.4 animations:^{
            weakSelf.width = SCREEN_WIDTH * 0.8;
        }];
    }];
}

//结束加载
- (void)endLoadingAnimation {
    __weak UIView *weakSelf = self;
    [UIView animateWithDuration:0.2 animations:^{
        weakSelf.width = SCREEN_WIDTH;
    } completion:^(BOOL finished) {
        weakSelf.hidden = YES;
    }];
}

@end
